/**
 * get the data from server and handle it
 */
function EDAO(clz) {
    this.clz = clz;
}
EDAO.prototype = {
    create: function(obj) {
        $http({
            "method": "post",
            "url": "/litejs/server",
            "data": {
                "clz": this.clz,
                "act":"create",
                "obj": obj
            },
            "success": function(data) {
                // deal with the data
                console.info(data);
            },
            "Error": function(text) {
                alert(text);
            },
            "async": false
        });
    },
    update: function(obj) {
        $http({
            "method": "post",
            "url": "/litejs/server",
            "data": {
                "clz": this.clz,
                "act":"update",
                "obj": obj
            },
            "success": function(data) {
                console.info(data);
            },
            "Error": function(text) {
                alert(text);
            },
            "async": false
        });
    },
    read: function(id) {
    	var userVO = null;
        $http({
            "method": "get",
            "url": "/litejs/server",
            "data": {
                "id": id,
                "act":"read",
                "clz": this.clz
            },
            "success": function(data) {
// console.info(data);
                userVO = data;
            },
            "Error": function(text) {
                alert(text);
            },
            "async": false
        });
        return userVO;
    },
    delete: function(id) {
        $http({
            "method": "post",
            "url": "/litejs/server",
            "data": {
                "clz": this.clz,
                "act":"delete",
                "id": id
            },
            "success": function(data) {
                console.info(data);
            },
            "Error": function(text) {
                alert(text);
            },
            "async": false
        });
    }
};
